//
//  CommonTitleCell.swift
//  Game
//
//  Created by woniu on 2025/9/1.
//

import Foundation
import UIKit

class CommonTitleCell: UITableViewCell {
    
    public var bgView:UIView!
    public var titleLab:UILabel!
    public var descLab:UILabel!
    public var line:UIView!
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupUI() {
        bgView = UIView()
        bgView.backgroundColor = .white
        bgView.circular5()
        self.contentView.addSubview(bgView)
        bgView.snp.makeConstraints { make in
            make.left.right.top.bottom.equalToSuperview()
        }
        
        titleLab = UILabel()
        titleLab.numberOfLines = 0
        titleLab.textColor = Colors.title
        titleLab.font = UIFont.boldSystemFont(ofSize: 17)
        bgView.addSubview(titleLab)
        titleLab.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(15)
            make.top.equalToSuperview().offset(10)
            make.bottom.equalToSuperview().offset(-10)
        }
        
        descLab = UILabel()
        descLab.textColor = Colors.title
        descLab.font = UIFont.systemFont(ofSize: 14)
        bgView.addSubview(descLab)
        descLab.snp.makeConstraints { make in
            make.right.equalToSuperview().offset(-15)
            make.top.equalToSuperview().offset(10)
            make.bottom.equalToSuperview().offset(-10)
        }
        
        
        line = UIView()
        line.backgroundColor = Colors.line2
        bgView.addSubview(line)
        line.snp.makeConstraints { make in
            make.left.right.bottom.equalToSuperview()
            make.height.equalTo(0.5)
        }
    }
}
